package com.bishe.demo.modules.account.dao;

import com.bishe.demo.modules.account.entity.UserRole;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface UserRoleDao {
    @Insert("insert into account_user_role values(null,#{userId},#{roleId})")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    void insertUserRole(UserRole userRole);

    @Delete("delete from account_user_role where user_id=#{userId}")
    void deleteUserRoleByUserId(int userId);

    @Delete("delete from account_user_role where role_id=#{roleId}")
    void deleteUserRoleByRoleId(int roleId);
}
